<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>个人资料</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/renting/css/public.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/renting/css/layui.css">
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/renting/css/header.css" />
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/renting/css/bottom.css"/>
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/renting/css/personal_public.css"/>
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/renting/css/personal.css"/>
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/renting/css/entry.css" />
    <link rel="stylesheet" href="${pageContext.request.contextPath}/layui/lib/layui-v2.6.3/css/layui.css" media="all">
    <style type="text/css">
        #createimg img{
            width: 100%;
            height: 100%;
            max-height: 160px;
        }
    </style>
</head>
<body>
<div class="header">
    <div class="nav">
        <a href="${pageContext.request.contextPath}/renting/index.jsp" class="nav_title">好客租房</a>
        <select class="select">
            <option value="重庆">重庆</option>
            <option value="贵阳">贵阳</option>
            <option value="重庆">重庆</option>
            <option value="贵阳">贵阳</option>
        </select>
        <ul class="nav_ul">
            <li><a href="${pageContext.request.contextPath}/renting/index.jsp">首页</a></li>
            <li><a href="${pageContext.request.contextPath}/renting/pages/onther/Findroom.jsp">轻松找房</a></li>
            <li><a href="${pageContext.request.contextPath}/renting/pages/onther/entry.jsp">房东入驻</a></li>
            <li><a href="${pageContext.request.contextPath}/renting/pages/onther/chat_news.jsp">消息</a></li>
            <li><a href="${pageContext.request.contextPath}/renting/pages/onther/login.jsp" style="color: #2981c8;">登录</a></li>
        </ul>
        <img src="${pageContext.request.contextPath}/renting/img/icon/lianxi-1.png" class="nav_img" style="margin-top: -20px;">
        <p class="nav_phone">
            <span>13301131116</span>
            <span>13301131116</span>
        </p>
    </div>
</div>
<div class="body">
    <div class="content">
        <ul class="left_ul">
            <li class="li_active"><a href="${pageContext.request.contextPath}/renting/pages/onther/personal.jsp"><img src="${pageContext.request.contextPath}/renting/img/xuanzhongtiao.png" >个人资料</a></li>
            <li>
                <a id="uploadFile" href="">
                    <img style="margin-left: 30px;margin-top:10px;width: 50px;height: 50px;border-radius: 100%" src="../../img/${drom.avater}">
                    头像
                </a>
            </li>
            <li style="height: 120px">
                <form enctype="multipart/form-data" method="post">
                    <div id="createimg" style="overflow: hidden" class="upload" >
                        <label style="display: inline-block;">
                            <img src="${pageContext.request.contextPath}/renting/img/addIMG.png" class="imgupl close2">
                            <input type="file" name="upLoadfile" id="houseImgs" class="imgup2" value="" hidden="hidden"/>
                            <p>添加图片</p>
                        </label>
                    </div>
                    <input type="button" style="margin-top: 20px;margin-left: 34%" class="layui-btn layui-btn-normal" id="sendUserImgBtn" value="上传头像">
                </form>
            </li>
        </ul>
        <div class="right_body">
            <div class="right_content">
                <div class="item">
                    <b>登录名</b>
                    <span>${drom.phone==null?'您未登陆':drom.phone}</span>
                    <a href="${pageContext.request.contextPath}/renting/pages/onther/modify_pswd.jsp">修改密码></a>
                </div>
                <div class="item">
                    <b>姓名</b>
                    <span>${drom.phone==null?'您未登陆':drom.name==null?'您未设置名称':drom.name}</span>
                    <a href="">.</a>
                </div>
                <div class="item">
                    <b>性别</b>
                    <span>${drom.phone==null?'您未登陆':drom.sex==1?'男':'女'}</span>
                    <a href="">.</a>
                </div>
                <div class="item">
                    <b>手机号</b>
                    <span>${drom.phone==null?'您未登陆':drom.phone==null?'您未设置电话号码':drom.phone}</span>
                    <a href="">.</a>
                </div>
                <div class="item">
                    <b>身份证号码</b>
                    <span>${drom.phone==null?'您未登陆':drom.idCard==null?'您未设置身份证号码':drom.idCard}</span>
                    <a href="">.</a>
                </div>
                <div class="item">
                    <b>职业信息</b>
                    <span>${drom.phone==null?'您未登陆':drom.jobInfo==null?(drom.isHouse==1?'房东':'您未设置职业'):drom.jobInfo}</span>
                    <a href="">.</a>
                </div>
                <div id="buttonBtn" style="margin-top: 20px;text-align: center">
                    <a style="float: left;margin-left: 10px" href="${pageContext.request.contextPath}/renting/pages/tenant/inspection.jsp" class="layui-btn layui-btn-primary">返回</a>
                    <a href="login.jsp" class="layui-btn layui-btn-primary">退出当前登陆</a>
                    <a style="float: right;margin-right:10px" href="modify_personal.jsp" class="layui-btn layui-btn-primary">修改个人信息</a>
                </div>
            </div>
        </div>
        <div style="clear: both;"></div>
    </div>
</div>
<div class="bottom">
    <p>沪公网安备 31011402005354号</p>
</div>
</body>
</html>
<script src="${pageContext.request.contextPath}/renting/js/jQuery-3.4.1.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/layui/lib/layui-v2.6.3/layui.js"></script>
<script src="${pageContext.request.contextPath}/renting/js/landlord_public.js"></script>
<script src="${pageContext.request.contextPath}/renting/js/person_imgset.js"></script>
<script src="${pageContext.request.contextPath}/renting/js/personal.js"></script>
<script src="${pageContext.request.contextPath}/renting/js/header.js"></script>
<script type="text/javascript">
    var login=sessionStorage.getItem("login");
    var url="";
    if(login==1){
        url="${pageContext.request.contextPath}/renting/pages/tenant/inspection.jsp";
    }
    if(login==2){
        url="${pageContext.request.contextPath}/renting/pages/landlord/release.jsp";
    }
    judge_login(url,"${pageContext.request.contextPath}/renting/pages/onther/login.jsp");


    //layui全局
    layui.use(['layer','upload'],function (){


        //底部两个按钮的动画
        $("#buttonBtn>a").hover(function (){
            $(this).addClass("layui-btn-normal");
        },function (){
            $(this).removeClass("layui-btn-normal");
        })

        //头像上传
        $("#sendUserImgBtn").click(function (){
            var file = $("#houseImgs")[0].files;
            if(file.length<1){
                layer.msg("您未选择好头像图片",{icon:2})
            }else{
                var formData = new FormData();
                formData.append("upLoadfile",file[0]);
                $.ajax({
                    url:'${pageContext.request.contextPath}/userInfo/userImg',
                    type:'post',
                    async: false,
                    data:formData,
                    processData: false,
                    contentType: false,
                    dataType:"json",
                    success:function (redata){
                        if(redata.statecode==0){
                            layer.msg("头像修改成功",{icon:1});
                        }else{
                            layer.msg("头像修改失败请稍候重试",{icon:2});
                        }
                    },
                    error:function (e){
                        console.log(e)
                    }
                })
            }
            return false;
        })
    })








</script>
